package org.example.AI;

import java.util.Stack;

/**
 * @author: 默苍璃
 * @date: 2024-07-18 15:02
 */
// 管理者类
public class TextEditorCareTaker {
    private Stack<TextEditorMemento> mementos = new Stack<>();

    public void saveMemento(TextEditorMemento memento) {
        mementos.push(memento);
    }

    public TextEditorMemento restoreMemento() {
        if (!mementos.isEmpty()) {
            return mementos.pop();
        }
        return null;
    }
}
